package com.yzr.helloworld;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.MessageProperties;
import com.yzr.util.RabbitMqClient;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer {
    public static void main(String[] args) throws IOException, TimeoutException {
        Connection connection = RabbitMqClient.getConnection();

        Channel channel = connection.createChannel();

        channel.queueDeclare("hello-world", true, false, false, null);
        channel.basicPublish("", "hello-world", MessageProperties.MINIMAL_PERSISTENT_BASIC, "hello rabbitmq".getBytes());

        RabbitMqClient.close(channel, connection);
    }

}
